<?php
use Jialeo\LaravelSchemaExtend\Schema;
//use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateShopConsultsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('shop_consults', function (Blueprint $table) {
            $table->comment = '咨询表';
            $table->increments('id')->comment('咨询ID');
			$table->string('title')->nullable()->comment('咨询标题');
			$table->string('author')->nullable()->comment('作者');
			$table->string('images')->nullable()->comment('图片多个用|线隔开');
			$table->tinyInteger('status')->default(1)->comment('状态:0=禁用,1=启用');
			$table->integer('sort')->default(1)->comment('排序');
			$table->integer('reading_quantity')->default(0)->nullable()->comment('阅读量');
			$table->integer('like_number')->default(0)->nullable()->comment('点赞数');
			$table->text('content')->nullable()->comment('详情');
            $table->timestamp('created_at')->nullable()->comment('创建时间');
			$table->timestamp('updated_at')->nullable()->comment('更新时间');
        });
		Schema::create('shop_consult_evaluates', function (Blueprint $table) {
            $table->comment = '咨询评价表';
            $table->increments('id')->comment('评价ID');
			$table->integer('user_id')->comment('用户id');
			$table->integer('consult_id')->comment('咨询id');
			$table->integer('pid')->comment('上级评价ID，0表示顶级');
			$table->string('content',100)->nullable()->comment('评价内容');
			$table->tinyInteger('status')->default(1)->comment('是否显示:0=否,1=是');
            $table->timestamp('created_at')->nullable()->comment('评价时间');
			$table->timestamp('updated_at')->nullable()->comment('更新时间');
        });
		Schema::create('shop_consult_likes', function (Blueprint $table) {
            $table->comment = '咨询点赞表';
            $table->increments('id')->comment('点赞ID');
			$table->integer('user_id')->comment('用户id');
			$table->integer('consult_id')->comment('咨询id');
            $table->timestamp('created_at')->nullable()->comment('点赞时间');
			$table->timestamp('updated_at')->nullable()->comment('更新时间');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('shop_consults');
        Schema::dropIfExists('shop_consult_evaluates');
        Schema::dropIfExists('shop_consult_likes');
    }
}
